package com.lwc.cfdns.controller.admin.monitor;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lwc.cfdns.constants.Constants;
import com.lwc.cfdns.constants.ConstantsUrl;
import com.lwc.cfdns.pojo.bo.monitor.OperLogBO;
import com.lwc.cfdns.pojo.entity.SystemOperLog;
import com.lwc.cfdns.service.impl.SystemOperLogServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.Map;

/**
 * 操作日志
 *
 * @author luwc
 * @title OperLogController
 * @description
 * @time 2023/8/2 21:50:31
 * @version: 1.0
 */
@RestController
@RequestMapping(ConstantsUrl.ADMIN + "/monitor")
public class OperLogController {
    @Autowired
    private SystemOperLogServiceImpl systemOperLogService;

    /**
     * 列表
     *
     * @param operLogBO
     * @return IPage<SystemOperLog>
     * @throws
     * @version 1.0.0
     * @author luwc
     * @time 2023/8/2 21:53:24
     */
    @GetMapping("/operlog")
    public IPage<SystemOperLog> lists(OperLogBO operLogBO) {
        return systemOperLogService.lists(operLogBO);
    }

    /**
     * 删除
     *
     * @param ids
     * @return Map<String, Object>
     * @throws
     * @version 1.0.0
     * @author luwc
     * @time 2023/8/2 22:00:38
     */
    @DeleteMapping("/operlog/{ids}")
    public Map<String, Object> delete(@PathVariable("ids") @NotNull(message = "ids不能为空") String ids) {
        return systemOperLogService.delete(ids);
    }

    /**
     * 清空日志
     *
     * @param
     * @return Map<String, Object>
     * @throws
     * @version 1.0.0
     * @author luwc
     * @time 2023/8/2 22:03:51
     */
    @DeleteMapping("/operlog/clear")
    public Map<String, Object> clear() {
        return systemOperLogService.clear();
    }
}
